package monster.com.cvh.database;

import android.content.Context;

import monster.com.cvh.gen.DaoMaster;
import monster.com.cvh.gen.DaoSession;

/**
 * @author: pengguanming
 * @data: 2018/4/26
 * @function:数据库管理类
 */
public class GreenDAOManager {
    private static final String TAG = "GreenDAOManager";
    private DaoMaster mDaoMaster;
    private DaoSession mDaoSession;

    private GreenDAOManager() {
    }

    public static GreenDAOManager getInstance() {
        return SingletonHolder.mInstance;
    }

    public void initGreenDAO(Context context) {
        DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(context, "resume_info.db", null);
        mDaoMaster = new DaoMaster(devOpenHelper.getWritableDatabase());
        mDaoSession = mDaoMaster.newSession();
    }

    public DaoSession getmDaoSession() {
        return mDaoSession;
    }

    private static class SingletonHolder {
        private static GreenDAOManager mInstance = new GreenDAOManager();
    }
}
